# Maintainer: Krassy Boykinov <kboykinov@teamcentrixx.com>
pkgname=onevpl
pkgver=2023.3.1
pkgrel=2
pkgdesc="oneAPI Video Processing Library"
url="https://github.com/oneapi-src/oneVPL"
arch="x86_64" # only x86_64 supported
license="MIT"
makedepends="cmake samurai"
subpackages="$pkgname-doc $pkgname-libs $pkgname-dev"
source="$pkgname-$pkgver.tar.gz::https://github.com/oneapi-src/oneVPL/archive/refs/tags/v$pkgver.tar.gz"
builddir="$srcdir/oneVPL-$pkgver"

build() {
	CXXFLAGS="$CXXFLAGS -flto=auto" \
	cmake -B build -G Ninja \
		-DCMAKE_BUILD_TYPE=Release \
		-DCMAKE_INSTALL_PREFIX=/usr \
		-DVPL_INSTALL_ENVDIR=/usr/share/oneVPL/env \
		-DVPL_INSTALL_LICENSEDIR=/usr/share/doc/oneVPL \
		-DVPL_INSTALL_MODFILEDIR=/usr/share/oneVPL/modulefiles \
		-DBUILD_PREVIEW=OFF \
		-DBUILD_EXAMPLES=OFF \
		-DBUILD_TOOLS=ON \
		-DINSTALL_EXAMPLE_CODE=OFF \
		-DBUILD_TESTS="$(want_check && echo ON || echo OFF)"
	cmake --build build
}

check() {
	ctest -j $JOBS --output-on-failure --test-dir build
}

package() {
	DESTDIR="$pkgdir" cmake --install build
}

dev() {
	default_dev

	amove usr/share
}

sha512sums="
1e8cc143f33438d3a4e1d65aa57dca4e0ebc1a47741b7a124a273cc609cc4ce789c0e230db3244010f5f1ca54f42cdd2e17d132b2c904af41607a2a0527c38ed  onevpl-2023.3.1.tar.gz
"
